<?php
/* Author : IronLady */

if (!defined('IS_ADMIN_FLAG')) {
  die('Illegal Access');
}

$sql = "SELECT r.reviews_id, r.products_id, r.customers_name, r.reviews_rating, rd.reviews_text FROM " . TABLE_REVIEWS . " r, " . TABLE_REVIEWS_DESCRIPTION . " rd
   		where r.products_id = '" . (int)$_GET['products_id'] . "'
   		and r.reviews_id = rd.reviews_id
   		and rd.languages_id = '" . (int)$_SESSION['languages_id'] . "'
   		and r.status = '1' LIMIT 0, 3";

$reviews_detail = $db->Execute($sql);

$avg_query = $db->Execute("SELECT avg(reviews_rating) as avg FROM " . TABLE_REVIEWS . " WHERE products_id = '". (int)$_GET['products_id'] ."' AND status = '1'");
$avg = $avg_query->fields['avg'];